<!DOCTYPE html>
<html class="x-admin-sm">
{include file='public/header'}
<script src="/admin/xadmin/lib/layui/upload.js" charset="utf-8"></script>
<style>
    .layui-form-label {
        width: 110px;
    }

    .layui-input-block {
        margin-left: 140px;
    }
</style>

<body>
    <div class="x-body">
        <form class="layui-form" lay-filter="formAjax">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>推荐语
                </label>
                <div class="layui-input-block">
                    <input type="text" name="recommendation" id="recommendation" placeholder="请输入推荐语"
                        required="required" lay-verify="required" autocomplete="off" class="layui-input" value="" />
                </div>
            </div>
            <!-- <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>短剧
                </label>
                <div id="pMenu" style="width:100%;flex:1"></div>
            </div> -->
            <div id="choosePerson">
                <div class="layui-form-item" style="display: flex;">
                    <label class="layui-form-label">
                        <span class="x-red">*</span> 标签名称
                    </label>
                    <div id="demo2" class="xm-select-demo" style="width: 90%;"></div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> <span class="x-red">*</span>发行年份</label>
                <div class="layui-input-inline">
                    <!-- <input type="text" class="layui-input" name="release_year" id="release_year" placeholder="yyyy"> -->
                    <input type="text"  name="release_year" id="release_year" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    是否更新图片
                </label>
                <div class="layui-input-block">
                    <input type="radio" name="is_upload_img" value="false" title="否" checked>
                    <input type="radio" name="is_upload_img" value="true" title="是">
                </div>
            </div>

            <input type="hidden" name="id" id="id" value="" />
            <button id="submitData" class="layui-btn" lay-submit lay-filter="submitData" style="display: none;" />

        </form>
    </div>
    <script>
        let params = {

            editUrl: '/admin/mediaAssets/syncShortPlay',
            detailUrl: '/admin/thirdVideo/detail',
        }


        // var personList = xmSelect.render({
        //     el: document.querySelector('#personList'),
        //     data: [
        //         [{ id: "1", name: "医神" }, { "id": "2", "name": "赘婿" }, { "id": "3", "name": "鉴宝" }, { "id": "4", "name": "战神" }, { "id": "5", "name": "娱乐明星" }, { "id": "6", "name": "神医" }, { "id": "7", "name": "重生" }, { "id": "8", "name": "职场" }, { "id": "9", "name": "逆袭" }, { "id": "10", "name": "复仇" }, { "id": "11", "name": "青春" }, { "id": "12", "name": "官场" }, { "id": "13", "name": "家庭情感" }, { "id": "14", "name": "乡村" }, { "id": "15", "name": "正能量" }, { "id": "16", "name": "成长" }, { "id": "17", "name": "伦理" }, { "id": "18", "name": "都市情感" }, { "id": "19", "name": "社会话题" }, { "id": "20", "name": "灵异" }, { "id": "21", "name": "悬疑推理" }, { "id": "22", "name": "虐恋" }, { "id": "23", "name": "甜宠" }, { "id": "24", "name": "高干军婚" }, { "id": "25", "name": "年代" }, { "id": "26", "name": "萌宝" }, { "id": "27", "name": "腹黑" }, { "id": "28", "name": "总裁" }, { "id": "29", "name": "宫斗宅斗" }, { "id": "30", "name": "穿越" }, { "id": "31", "name": "种田经商" }, { "id": "33", "name": "民俗" }, { "id": "34", "name": "古装" }, { "id": "35", "name": "穿越战争" }, { "id": "36", "name": "现代军事" }, { "id": "37", "name": "奇幻" }, { "id": "38", "name": "科幻" }, { "id": "39", "name": "架空玄幻" }, { "id": "40", "name": "热血" }, { "id": "41", "name": "历史" }, { "id": "42", "name": "搞笑" }, { "id": "43", "name": "仙侠" }, { "id": "44", "name": "武侠" }, { "id": "45", "name": "二次元" }, { "id": "46", "name": "其他" }]
        //     ]
        // })

        layui.use('laydate', function () {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#release_year', //指定元素
                type: 'year'
            });
        });

        var demo2 = xmSelect.render({
            el: document.querySelector('#demo2'),
            name: 'tag_ids',
            max: 3,
            data: [
                { value: 1, name: "医神" },
                { value: 2, name: "赘婿" },
                { value: 3, name: "鉴宝" },
                { value: 4, name: "战神" },
                { value: 5, name: "娱乐明星" },
                { value: 6, name: "神医" },
                { value: 7, name: "重生" },
                { value: 8, name: "职场" },
                { value: 9, name: "逆袭" },
                { value: 10, name: "复仇" },
                { value: 11, name: "青春" },
                { value: 12, name: "官场" },
                { value: 13, name: "家庭情感" },
                { value: 14, name: "乡村" },
                { value: 15, name: "正能量" },
                { value: 16, name: "成长" },
                { value: 17, name: "伦理" },
                { value: 18, name: "都市情感" },
                { value: 19, name: "社会话题" },
                { value: 20, name: "灵异" },
                { value: 21, name: "悬疑推理" },
                { value: 22, name: "虐恋" },
                { value: 23, name: "甜宠" },
                { value: 24, name: "高干军婚" },
                { value: 25, name: "年代" },
                { value: 26, name: "萌宝" },
                { value: 27, name: "腹黑" },
                { value: 28, name: "总裁" },
                { value: 29, name: "宫斗宅斗" },
                { value: 30, name: "穿越" },
                { value: 31, name: "种田经商" },
                { value: 33, name: "民俗" },
                { value: 34, name: "古装" },
                { value: 35, name: "穿越战争" },
                { value: 36, name: "现代军事" },
                { value: 37, name: "奇幻" },
                { value: 38, name: "科幻" },
                { value: 39, name: "架空玄幻" },
                { value: 40, name: "热血" },
                { value: 41, name: "历史" },
                { value: 42, name: "搞笑" },
                { value: 43, name: "仙侠" },
                { value: 44, name: "武侠" },
                { value: 45, name: "二次元" },
                { value: 46, name: "其他" }]
        })

        // demo2.setValue([ 1,2,4])
        form_ajax(params)


        let id = GetQueryString('id')
        if (id) {
            Ajax(params.detailUrl, { id }).then(result => {

                // console.log($('#recommendation').val());
                demo2.setValue(result.data.config.tag_ids)
                $('#recommendation').val(result.data.config.recommendation)
                $('#release_year').val(result.data.config.release_year)

            });
        } else {
            // selectN(selectParams)
        }
    </script>
</body>

</html>